package isometric
{
	import flash.geom.Point;

	public class IsoUtils extends Object
	{
		public static const Y_CORRECT:Number = Math.cos(-Math.PI / 6) * Math.SQRT2; 
		
		public function IsoUtils()
		{
			super();
		}
		
		public static function isoToScreen(point3d:Point3D):Point{
			var result:Point;
			var sx:Number = point3d.x - point3d.z;
			var sy:Number = point3d.y * Y_CORRECT + (point3d.x + point3d.z)*0.5;
			result = new Point(sx,sy);
			return result;
		}
		
		public static function screenToIso(point:Point):Point3D{
			var result:Point3D;
			var x:Number = point.y + point.x * .5;
			var y:Number = 0;
			var z:Number = point.y - point.x * .5;
			result = new Point3D(x,y,z);
			return result;
		}
	}
}